package com.javacodegeeks.android.googlemaps;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
/**
 * Class used show map for user
 * @author ThangLQ
 *
 */
public class GMapsActivity extends MapActivity {
	/**
	 * Show map for user
	 */
	private MapView mMapView;
	/**
	 * Latitude of point
	 */
	private static final int latitudeE6 = 37985339;
	/**
	 * Longitude of point
	 */
	private static final int longitudeE6 = 23716735;
	/*************************************************
	 * Called when the GMaspsActivity is first created
	 *************************************************/
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mymap);
        
        mMapView = (MapView) findViewById(R.id.map_view);       
        mMapView.setBuiltInZoomControls(true);
        
        List<Overlay> mMapOverlays = mMapView.getOverlays();
        Drawable mDrawable = this.getResources().getDrawable(R.drawable.pin);
		CustomItemizedOverlay mItemizedOverlay = new CustomItemizedOverlay(mDrawable, this);
		
		GeoPoint point = new GeoPoint(latitudeE6, longitudeE6);
		OverlayItem overlayitem = new OverlayItem(point, "Hello", "I'm in Athens, Greece!");
		
		mItemizedOverlay.addOverlay(overlayitem);
		mMapOverlays.add(mItemizedOverlay);
		
		MapController mMapController = mMapView.getController();
		
		mMapController.animateTo(point);
		mMapController.setZoom(6);
        
    }

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
    
}